#include <stdio.h>
#include <math.h>
#define PI 3.14159265

void glRotatef (float angle, float x, float y, float z){

	float _x,_y,_z, R[9],_cos,_sin;
	//float newMt[16];
	int i = 0;
	_x = x/(sqrt(x*x+y*y+z*z));
	_y = y/(sqrt(x*x+y*y+z*z));
	_z = z/(sqrt(x*x+y*y+z*z));
	
	float U[9] = {_x*_x, _x*_y, _x*_z,
		 _y*_x, _y*_y, _y*_z,
		 _z*_x, _z*_y, _z*_z};
		 
	float S[9] = {0, _z, -_y,
		-_z, 0, _x,
		_y, -_x, 0}; 
	
	float I[9] = {1, 0, 0,
		 0, 1, 0,
		 0, 0, 1};

	_cos = cos(angle);
	_sin = sin(angle);
	
	for (i = 0; i < 9; i++){
		R[i] = U[i] + _cos*(I[i] - U[i]) + _sin*S[i];
	}

	float newMt[16] = {R[0], R[1], R[2], 0,
			 R[3], R[4], R[5], 0,
			 R[6], R[7], R[8], 0,
			  0,     0,   0,   1};

	printf(" %f, %f, %f, %f\n  %f, %f, %f, %f\n %f, %f, %f, %f\n  %f, %f, %f, %f\n ",
			newMt[0],newMt[1],newMt[2],newMt[3],newMt[4],newMt[5],newMt[6],newMt[7],newMt[8],
			newMt[9],newMt[10],newMt[11],newMt[12],newMt[13],newMt[14],newMt[15]);

}
void main(){
	glRotatef(PI/4,1.0f,1.0f,1.0f);
}
	
